//
//  XQActionSheet.h
//  JoinPeso
//
//  Created by 小琦 on 2024/11/23.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@class XQActionSheet;
typedef void(^XQActionSheetBlock)(NSInteger buttonIndex);

@protocol XQActionSheetDelegate <NSObject>
@optional
/**
 *  新增一个协议方法
 */
- (void)actionSheet:(XQActionSheet *)actionSheet didClickedButtonAtIndex:(NSInteger)buttonIndex;

@end

@interface XQActionSheet : UIView

@property (nonatomic ,copy) XQActionSheetBlock clickBlock;

@property (nonatomic ,weak) id<XQActionSheetDelegate> delegate;

@property (nonatomic, copy) void (^dismissBlock)(void);
#pragma mark - 构造方法
/**
 *  初始化方法
 *
 *  @param buttonTitles 需要以数组形式传入
 *  @param cancleTitle  取消按钮的名称
 *  @param clicked      回调的block
 */

+ (instancetype)sheetWithButtonTitles:(NSArray *)buttonTitles andCancleTitle:(NSString *)cancleTitle clicked:(XQActionSheetBlock)clicked;

- (instancetype)initWithButtonTitles:(NSArray *)buttonTitles andCancleTitle:(NSString *)cancleTitle  clicked:(XQActionSheetBlock)clicked;

/**
 *  初始化方法
 *
 *  @param buttonTitles   传入参数数组
 *  @param cancleTitle    取消按钮
 *  @param redButtonIndex 红色字体按钮
 *  @param clicked        点击的回调
 */
+ (instancetype)sheetWithButtonTitles:(NSArray *)buttonTitles andCancleTitle:(NSString *)cancleTitle redButtonIndex:(NSInteger)redButtonIndex clicked:(XQActionSheetBlock)clicked;

- (instancetype)initWithButtonTitles:(NSArray *)buttonTitles andCancleTitle:(NSString *)cancleTitle redButtonIndex:(NSInteger)redButtonIndex clicked:(XQActionSheetBlock)clicked;
/**
 *  初始化方法
 *
 *  @param buttonTitles   参数数组
 *  @param cancleTitle    取消按钮
 *  @param redButtonIndex 红色按钮的索引
 *  @param delegate       协议
 */
+ (instancetype)sheetWithButtonTitles:(NSArray *)buttonTitles andCancleTitle:(NSString *)cancleTitle redButtonIndex:(NSInteger)redButtonIndex delegate:(id<XQActionSheetDelegate>)delegate;

- (instancetype)initWithButtonTitles:(NSArray *)buttonTitles andCancleTitle:(NSString *)cancleTitle redButtonIndex:(NSInteger)redButtonIndex delegate:(id<XQActionSheetDelegate>)delegate;
/**
 *  添加红色字体按钮
 */
@property (nonatomic, assign) NSInteger redButtonIndex;

/**
 *  添加蓝色字体按钮
 */
@property (nonatomic, assign) NSInteger blueButtonIndex;

/**
 *  show的方法
 */
- (void)show;

- (void)hide;

- (void)showInView:(UIView *)view;

@end

NS_ASSUME_NONNULL_END
